//
//  CellForList.m
//  UI23_UICollectionView
//
//  Created by Scott on 16/1/13.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "CellForList.h"

@implementation CellForList

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        NSLog(@"%s", __FUNCTION__);
        // 创建子控件.
        self.pic = [[UIImageView alloc] init];
        
        [self.contentView addSubview:self.pic];
        
        self.pic.backgroundColor = [UIColor brownColor];
    }
    return self;
}

/** collectionCell 的子控件布局通常在此方法中设置 */
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    
    self.pic.frame = self.contentView.frame;
    
//    NSLog(@"att: %@", layoutAttributes);
    NSLog(@"%s", __FUNCTION__);
}


- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    
    NSLog(@"%s", __FUNCTION__);

    return layoutAttributes;
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    NSLog(@"%s", __FUNCTION__);
}


@end
